﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using GameCore;

public class UIState_SHGameHallState : EntityState {

    public static bool doNothing = false;
    public static bool ifComeFromH5 = false;
    public static string H5RoomId = "";
    public UIState_SHGameHallState(int iStateId, EntityState eState) : base(iStateId, eState) { }

    public bool Scenemanager { get; private set; }

    protected override void OnStateBegin(object[] command)
    {
        if (doNothing)
        {
            return;
        }

        if (ifComeFromH5)
        {
            if (!string.IsNullOrEmpty(GameRoomModel.GetInstance().RoomID))
            {
                LoginAndShare.Controller.ShowAndroidMsg("您未退出之前的房间，无法进入新的房间！");
                ifComeFromH5 = false;
            }
            else
            {
                MessageManager.GetInstance().SendMsg126();
                ifComeFromH5 = false;
            } 
        }

        //如果进入大厅状态玩家身上有房间号
        if (!string.IsNullOrEmpty(GameRoomModel.GetInstance().RoomID))
        {
            MessageManager.GetInstance().SendMsg126();
        }

        UIManager.ChangeUI(UIManager.PageState.GameHallPage, (GameObject obj) =>
        {
            obj.GetComponent<GameHallPanel>().InformationSetting();
        });
    }

    //-------------------------------------------------------------------------
    protected override void OnStateEnd()
    {

    }
    //-------------------------------------------------------------------------
    protected override void OnUpdate()
    {

    }
    public override void OnFinishedMsg(string id)
    {

        Debug.Log("UIState_LoginPage.OnFinishedMsg");
    }

}
